import {createStore} from 'vuex';

const store = createStore({
    state() {
        return {
            sharedVariable: 'Initial value', // 共享的变量
            school_id: 0,
        };
    },
    mutations: {
        updateVariable(state, payload) {
            state.sharedVariable = payload; // 更新共享变量的值
        },
        updateSchoolId(state, payload) {
            state.school_id = payload; // 更新共享变量的值
        }

    },
    getters: {
        getVariable(state) {
            return state.sharedVariable; // 获取共享变量的值
        },
        getSchoolId(state) {
            return state.school_id; // 获取共享变量的值
        }

    }
});

export default store;
